package com.qf.servlet;

import com.qf.entity.Classes;
import com.qf.service.ClassesService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 班级修改前的查询Servlet
 * description:
 * author: Ken
 * 公众号：Java架构栈
 */
@WebServlet(urlPatterns = "/classesupdatequery")
public class ClassUpdateQueryServlet extends HttpServlet {

    private ClassesService classesService = new ClassesService();

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获得需要修改的班级信息
        String cid = req.getParameter("mycheckbox");

        //根据班级id查询班级信息 - service
        Classes classes = classesService.queryClsOne(cid);
        //放入request作用域
        req.setAttribute("classes", classes);
        //转发到班级修改页面
        req.getRequestDispatcher("classesupdate.jsp").forward(req, resp);
    }
}
